import { getNumber } from "@/api/message";

const state = {
  totalMsg: ""
};
// 标注
const mutations = {
  changeMsg: (state, totalMsg) => {
    state.totalMsg = totalMsg;
  }
};

const actions = {
  async getMsg({ commit }, id) {
    var res = await getNumber(id);
    var { overdueNum, todayNum, weekNum, tomorrowNum } = res.data;
    var allNub = overdueNum + todayNum + weekNum + tomorrowNum;
    commit("changeMsg", allNub);
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};
